/*
 * main.cpp
 *
 *  Created on: 2009/11/24
 *      Author: Peter.Song
 */

#include <iostream>
#include "Test.h"

using namespace std;

#define MEMORY_POOL
#define THREAD_NUM 10

int main()
{
#ifdef MEMORY_POOL
	std::cout << "Thread local memory Pool Test --begin" << std::endl;
#else
	std::cout << "Normal allocation Test --begin" << std::endl;
#endif

	CTest* pTestInstance = NULL;

#ifdef MEMORY_POOL
	//Initial main thread local memory pool manually
	CXThread::Initalize();

	pTestInstance = new CMemPool(THREAD_NUM);
#else
	pTestInstance = new CNormal(THREAD_NUM);
#endif

	pTestInstance->run_test();

#ifdef MEMORY_POOL
	//Release main thread mem_pool manually
	CXThread::Finalize();

	CGlobalMemPool::ReleaseInstance();

	std::cout << "Thread local memory Pool Test --end" << std::endl;
#else
	std::cout << "Normal allocation Test --end" << std::endl;
#endif

	delete pTestInstance;
	pTestInstance = NULL;

	return 0;
}
